package org.jiuling.gaode.geocode.model;

import com.alibaba.fastjson2.annotation.JSONField;
import org.jiuling.basics.validation.StringVerify;

import java.util.List;

/**
 * 地理编码响应模型
 * @author 紫灵
 * @date 2024年11月14日 17时33分20秒
 */
public class GeoCodeResponseModel {

    /** 结果状态值 */
    private boolean status;
    /** 状态说明 */
    private String info;
    /** 数据 */
    @JSONField(name = "geocodes")
    private List<GeoCodeModel> geoCodeList;
    /** 结果数目 */
    private int count;
    /** 状态码 */
    @JSONField(name = "infocode")
    private int infoCode;

    public int getInfoCode() {
        return infoCode;
    }

    public void setInfoCode(int infoCode) {
        this.infoCode = infoCode;
    }

    public boolean isStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status.equals("1");
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }


    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public List<GeoCodeModel> getGeoCodeList() {
        return geoCodeList;
    }

    public void setGeoCodeList(List<GeoCodeModel> geoCodeList) {
        this.geoCodeList = geoCodeList;
    }

    /**
     * 地理编码模型
     * @author 紫灵
     * @date 2024年11月15日 00时23分54秒
     */
    public static class GeoCodeModel{
        /** 格式化地址 */
        @JSONField(name = "formatted_address")
        private String formattedAddress;
        /** 坐标点所在乡镇/街道（此街道为社区街道，不是道路信息） */
        private List<String> township;
        /** 楼信息 */
        private Building building;
        /** 社区信息列表 */
        private Neighborhood neighborhood;
        /** 国家 */
        private String country;
        /** 省份 */
        private String province;
        /** 城市 */
        private String city;
        /** 城市编码 */
        @JSONField(name = "citycode")
        private String cityCode;
        /** 区县 */
        private String district;
        /** 街道 */
        private String street;
        /** 门牌 */
        private String number;
        /** 区域编码 */
        @JSONField(name = "adcode")
        private String adCode;
        /** 坐标点（经度，纬度） */
        private String location;
        /** 匹配级别 */
        private String level;

        public String getFormattedAddress() {
            return formattedAddress;
        }

        public void setFormattedAddress(String formattedAddress) {
            this.formattedAddress = formattedAddress;
        }

        public List<String> getTownship() {
            return township;
        }

        public void setTownship(List<String> township) {
            this.township = township;
        }

        public Building getBuilding() {
            return building;
        }

        public void setBuilding(Building building) {
            this.building = building;
        }

        public Neighborhood getNeighborhood() {
            return neighborhood;
        }

        public void setNeighborhood(Neighborhood neighborhood) {
            this.neighborhood = neighborhood;
        }

        public String getCountry() {
            return country;
        }

        public void setCountry(String country) {
            this.country = country;
        }

        public String getProvince() {
            return province;
        }

        public void setProvince(String province) {
            this.province = province;
        }

        public String getCity() {
            return city;
        }

        public void setCity(String city) {
            this.city = city;
        }

        public String getCityCode() {
            return cityCode;
        }

        public void setCityCode(String cityCode) {
            this.cityCode = cityCode;
        }

        public String getDistrict() {
            return district;
        }

        public void setDistrict(String district) {
            this.district = district;
        }

        public String getStreet() {
            return street;
        }

        public void setStreet(String street) {
            if (!StringVerify.isBlankOrSame(street,"[]")){
                this.street = street;
            }
        }

        public String getNumber() {
            return number;
        }

        public void setNumber(String number) {
            if (!StringVerify.isBlankOrSame(number,"[]")){
                this.number = number;
            }
        }

        public String getAdCode() {
            return adCode;
        }

        public void setAdCode(String adCode) {
            this.adCode = adCode;
        }

        public String getLocation() {
            return location;
        }

        public void setLocation(String location) {
            this.location = location;
        }

        public String getLevel() {
            return level;
        }

        public void setLevel(String level) {
            this.level = level;
        }

        /**
         * 社区信息
         */
        public static class Neighborhood{
            /** 社区名称 */
            @JSONField(name = "name")
            private List<String> nameList;
            /** POI 类型 */
            @JSONField(name = "type")
            private List<String> typeList;

            public List<String> getNameList() {
                return nameList;
            }

            public void setNameList(List<String> nameList) {
                this.nameList = nameList;
            }

            public List<String> getTypeList() {
                return typeList;
            }

            public void setTypeList(List<String> typeList) {
                this.typeList = typeList;
            }
        }

        public static class Building{
            /** 建筑名称 */
            @JSONField(name = "name")
            private List<String> nameList;
            /** 类型 */
            @JSONField(name = "type")
            private List<String> typeList;

            public List<String> getNameList() {
                return nameList;
            }

            public void setNameList(List<String> nameList) {
                this.nameList = nameList;
            }

            public List<String> getTypeList() {
                return typeList;
            }

            public void setTypeList(List<String> typeList) {
                this.typeList = typeList;
            }
        }
    }
}
